import time

import unittest2

from util.selenium import webdriver
from util.selenium.webdriver import ChromeOptions

# from HandelCookies import handel_cookies
from PageObject.login_page import LoginPage
from settings import chrome_driver_path, start_url


##########   gitee 远程仓库地址
# https://gitee.com/datacenter-han/autoflow.git


class Start(unittest2.TestCase):


    def setUp(self):
        option = ChromeOptions()

        option.add_experimental_option('excludeSwitches', ['enable-automation'])

        self.driver = webdriver.Chrome(executable_path=chrome_driver_path, options=option)
        # self.driver = webdriver.Firefox()
        # self.driver = webdriver.Ie()

        self.driver.maximize_window()
        self.driver.implicitly_wait(10)

        self.driver.get(start_url)


    def testInput(self):
        LoginPage(driver=self.driver).login()


        # cookies_list = self.driver.get_cookies()
        #
        # print(cookies_list)
        #
        # cookie_str = handel_cookies(cookies_list)
        # print(cookie_str)




    def tearDown(self):
        time.sleep(5)
        self.driver.quit()
